#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h> 
#include <math.h>

void generate6(FILE *hf)
{
	char key[62] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n',\
		'o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N',\
		'O','P','Q','R','S','T','U','V','W','X','Y','Z'};
	
	char password[7];

	unsigned long long i = 0;
	int j = 0;
	unsigned long long n = 0;

	int keylen = strlen(key);
	unsigned long long allnum = pow(keylen,6);
	for(i=0;i<allnum;i++)
	{
		printf("%d\n",i - (unsigned long long )5000);
		n = i;
		password[5]=key[n%keylen];
		n=n/keylen;
		password[4]=key[n%keylen];
		n=n/keylen;
		password[3]=key[n%keylen];
		n=n/keylen;
		password[2]=key[n%keylen];
		n=n/keylen;
		password[1]=key[n%keylen];
		n=n/keylen;
		password[0]=key[n%keylen];
		n=n/keylen;

		password[6] = '\n';
		
		fwrite(password, 7, 1, hf);

	}
}


void generate7(FILE *hf)
{
	
	char key[3] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n',\
		'o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4',\
		'5','6','7','8','9','0'};
	
	char password[8];

	unsigned long long i = 0;
	int j = 0;
	unsigned long long n = 0;

	int keylen = strlen(key);
	unsigned long long allnum = pow(keylen,7);
	for(i=0;i<allnum;i++)
	{
		n = i;
		password[6]=key[n%keylen];
		n=n/keylen;
		password[5]=key[n%keylen];
		n=n/keylen;
		password[4]=key[n%keylen];
		n=n/keylen;
		password[3]=key[n%keylen];
		n=n/keylen;
		password[2]=key[n%keylen];
		n=n/keylen;
		password[1]=key[n%keylen];
		n=n/keylen;
		password[0]=key[n%keylen];
		n=n/keylen;

		password[7] = '\n';
		
		fwrite(password, 8, 1, hf);
	}
}

void generate13(FILE *hf)
{
	
	char key[10] = {'1','2','3','4','5','6','7','8','9','0'};
	
	char password[12];

	unsigned long long i = 0;
	int j = 0;
	unsigned long long n = 0;

	int keylen = strlen(key);
	unsigned long long allnum = pow(keylen,9);
	for(i=0;i<allnum;i++)
	{
		n = i;
		password[10]=key[n%keylen];
		n=n/keylen;
		password[9]=key[n%keylen];
		n=n/keylen;
		password[8]=key[n%keylen];
		n=n/keylen;
		password[7]=key[n%keylen];
		n=n/keylen;
		password[6]=key[n%keylen];
		n=n/keylen;
		password[5]=key[n%keylen];
		n=n/keylen;
		password[4]=key[n%keylen];
		n=n/keylen;
		password[3]=key[n%keylen];
		n=n/keylen;
		password[2]=key[n%keylen];
		n=n/keylen;
		password[1]='3';
		password[0]='1';


		password[11] = '\n';
		
		fwrite(password, 12, 1, hf);
	}
}

void generate15(FILE *hf)
{
	
	char key[10] = {'1','2','3','4','5','6','7','8','9','0'};
	
	char password[12];

	unsigned long long i = 0;
	int j = 0;
	unsigned long long n = 0;

	int keylen = strlen(key);
	unsigned long long allnum = pow(keylen,9);
	for(i=0;i<allnum;i++)
	{
		n = i;
		password[10]=key[n%keylen];
		n=n/keylen;
		password[9]=key[n%keylen];
		n=n/keylen;
		password[8]=key[n%keylen];
		n=n/keylen;
		password[7]=key[n%keylen];
		n=n/keylen;
		password[6]=key[n%keylen];
		n=n/keylen;
		password[5]=key[n%keylen];
		n=n/keylen;
		password[4]=key[n%keylen];
		n=n/keylen;
		password[3]=key[n%keylen];
		n=n/keylen;
		password[2]=key[n%keylen];
		n=n/keylen;
		password[1]='5';
		password[0]='1';

		password[11] = '\n';
		
		fwrite(password, 12, 1, hf);
	}
}

void generate17(FILE *hf)
{
	
	char key[10] = {'1','2','3','4','5','6','7','8','9','0'};
	
	char password[12];

	unsigned long long i = 0;
	int j = 0;
	unsigned long long n = 0;

	int keylen = strlen(key);
	unsigned long long allnum = pow(keylen,9);
	for(i=0;i<allnum;i++)
	{
		n = i;
		password[10]=key[n%keylen];
		n=n/keylen;
		password[9]=key[n%keylen];
		n=n/keylen;
		password[8]=key[n%keylen];
		n=n/keylen;
		password[7]=key[n%keylen];
		n=n/keylen;
		password[6]=key[n%keylen];
		n=n/keylen;
		password[5]=key[n%keylen];
		n=n/keylen;
		password[4]=key[n%keylen];
		n=n/keylen;
		password[3]=key[n%keylen];
		n=n/keylen;
		password[2]=key[n%keylen];
		n=n/keylen;
		password[1]='7';
		password[0]='1';


		password[11] = '\n';
		
		fwrite(password, 12, 1, hf);
	}
}

void generate18(FILE *hf)
{
	
	char key[10] = {'1','2','3','4','5','6','7','8','9','0'};
	
	char password[12];

	unsigned long long i = 0;
	int j = 0;
	unsigned long long n = 0;

	int keylen = strlen(key);
	unsigned long long allnum = pow(keylen,9);
	for(i=0;i<allnum;i++)
	{
		n = i;
		password[10]=key[n%keylen];
		n=n/keylen;
		password[9]=key[n%keylen];
		n=n/keylen;
		password[8]=key[n%keylen];
		n=n/keylen;
		password[7]=key[n%keylen];
		n=n/keylen;
		password[6]=key[n%keylen];
		n=n/keylen;
		password[5]=key[n%keylen];
		n=n/keylen;
		password[4]=key[n%keylen];
		n=n/keylen;
		password[3]=key[n%keylen];
		n=n/keylen;
		password[2]=key[n%keylen];
		n=n/keylen;
		password[1]='8';
		password[0]='1';


		password[11] = '\n';
		
		fwrite(password, 12, 1, hf);
	}
}


void generatebirth(FILE *hf)
{
	
	char key[10] = {'1','2','3','4','5','6','7','8','9','0'};
	
	char password[9];

	unsigned long long i = 0;
	int j = 0;
	unsigned long long n = 0;

	int keylen = strlen(key);
	unsigned long long allnum = pow(keylen,8);
	for(i=0;i<allnum;i++)
	{
		n = i;
		password[7]=key[n%keylen];
		n=n/keylen;
		password[6]=key[n%keylen];
		n=n/keylen;
		password[5]=key[n%keylen];
		n=n/keylen;
		password[4]=key[n%keylen];
		n=n/keylen;
		password[3]=key[n%keylen];
		n=n/keylen;
		password[2]=key[n%keylen];
		n=n/keylen;
		password[1]=key[n%keylen];
		n=n/keylen;
		password[0]=key[n%keylen];
		n=n/keylen;

		password[8] = '\n';
		
		fwrite(password, 9, 1, hf);
	}
}

int main()
{
	FILE *hf = fopen("mypass.txt","w");
	
	generate6(hf);
	generate7(hf);
	generate18(hf);
	generate13(hf);
	generate17(hf);
	generate15(hf);
	generatebirth(hf);
	
	fclose(hf);
}

